﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MTK_BieuThuc
{
    public class MulExpr : BinaryExpr
    {
        public MulExpr(Expression e1, Expression e2)
        {
            expr1 = e1;
            expr2 = e2;
        }
        public override double Evuluate(double x)
        {
            return expr2.Evuluate(x) * expr2.Evuluate(x);
        }
        public override Expression createDerive()
        {
            return new AddExpr(new MulExpr(expr1.derive(), expr2), new MulExpr(expr1, expr2.derive()));
        }
        public override string toString(StrategyString ss)
        {
             return ss.toString(this, expr1, expr2);;
        }
        public override string getOperator()
        {
            return "*";
        }
    }
}
